package com.luweijie.controller;

import com.luweijie.entity.po.testpo;
import com.luweijie.entity.vo.Result;
import com.luweijie.service.TestServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * 读写分离
 * */
@RestController
public class TestController {
    @Autowired
   TestServiceImpl TestServiceImpl;

    @PostMapping("/test")
    public Result insertProd(@RequestBody testpo shzwGoodsProduct){
        boolean save = TestServiceImpl.save(shzwGoodsProduct);
        if (!save) {
            return Result.fail();
        }
        return Result.success();
    }
    @GetMapping("/gettest")
    public Result insertProd(@RequestParam int id ){
        testpo byId = TestServiceImpl.getById(id);
        return Result.success(byId);
    }
}
